.class public Lcom/noshufou/android/su/LogFragment;
.super Landroid/support/v4/app/ListFragment;
.source "LogFragment.java"

# interfaces
.implements Landroid/support/v4/app/LoaderManager$LoaderCallbacks;
.implements Lcom/noshufou/android/su/FragmentWithLog;
.implements Landroid/view/View$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/support/v4/app/ListFragment;",
        "Landroid/support/v4/app/LoaderManager$LoaderCallbacks",
        "<",
        "Landroid/database/Cursor;",
        ">;",
        "Lcom/noshufou/android/su/FragmentWithLog;",
        "Landroid/view/View$OnClickListener;"
    }
.end annotation


# static fields
.field private static final TAG:Ljava/lang/String; = "Su.LogFragment"


# instance fields
.field private mAdapter:Lcom/noshufou/android/su/widget/LogAdapter;

.field private mLogCountTextView:Landroid/widget/TextView;


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    const/4 v0, 0x0

    .line 21
    invoke-direct {p0}, Landroid/support/v4/app/ListFragment;-><init>()V

    .line 25
    iput-object v0, p0, Lcom/noshufou/android/su/LogFragment;->mAdapter:Lcom/noshufou/android/su/widget/LogAdapter;

    .line 26
    iput-object v0, p0, Lcom/noshufou/android/su/LogFragment;->mLogCountTextView:Landroid/widget/TextView;

    .line 21
    return-void
.end method

.method public static newInstance()Lcom/noshufou/android/su/LogFragment;
    .locals 1

    .prologue
    .line 29
    new-instance v0, Lcom/noshufou/android/su/LogFragment;

    invoke-direct {v0}, Lcom/noshufou/android/su/LogFragment;-><init>()V

    return-object v0
.end method

.method private setupListView()V
    .locals 8

    .prologue
    const/4 v7, 0x0

    .line 62
    invoke-virtual {p0}, Lcom/noshufou/android/su/LogFragment;->getListView()Landroid/widget/ListView;

    move-result-object v1

    .line 63
    .local v1, list:Landroid/widget/ListView;
    invoke-virtual {p0}, Lcom/noshufou/android/su/LogFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v4

    invoke-virtual {v4}, Landroid/support/v4/app/FragmentActivity;->getLayoutInflater()Landroid/view/LayoutInflater;

    move-result-object v0

    .line 65
    .local v0, inflater:Landroid/view/LayoutInflater;
    invoke-virtual {v1, v7}, Landroid/widget/ListView;->setDividerHeight(I)V

    .line 67
    new-instance v4, Lcom/noshufou/android/su/widget/LogAdapter;

    const/4 v5, 0x0

    invoke-virtual {p0}, Lcom/noshufou/android/su/LogFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v6

    invoke-direct {v4, v5, v6}, Lcom/noshufou/android/su/widget/LogAdapter;-><init>(Landroid/database/Cursor;Landroid/content/Context;)V

    iput-object v4, p0, Lcom/noshufou/android/su/LogFragment;->mAdapter:Lcom/noshufou/android/su/widget/LogAdapter;

    .line 68
    iget-object v4, p0, Lcom/noshufou/android/su/LogFragment;->mAdapter:Lcom/noshufou/android/su/widget/LogAdapter;

    invoke-virtual {p0, v4}, Lcom/noshufou/android/su/LogFragment;->setListAdapter(Landroid/widget/ListAdapter;)V

    .line 70
    instance-of v4, v1, Lcom/noshufou/android/su/widget/PinnedHeaderListView;

    if-eqz v4, :cond_0

    .line 71
    iget-object v4, p0, Lcom/noshufou/android/su/LogFragment;->mAdapter:Lcom/noshufou/android/su/widget/LogAdapter;

    invoke-virtual {v4}, Lcom/noshufou/android/su/widget/LogAdapter;->getDisplaySectionHeadersEnabled()Z

    move-result v4

    if-eqz v4, :cond_0

    move-object v3, v1

    .line 73
    check-cast v3, Lcom/noshufou/android/su/widget/PinnedHeaderListView;

    .line 74
    .local v3, pinnedHeaderListView:Lcom/noshufou/android/su/widget/PinnedHeaderListView;
    const v4, 0x7f03000f

    invoke-virtual {v0, v4, v1, v7}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v2

    .line 75
    .local v2, pinnedHeader:Landroid/view/View;
    invoke-virtual {v3, v2}, Lcom/noshufou/android/su/widget/PinnedHeaderListView;->setPinnedHeaderView(Landroid/view/View;)V

    .line 78
    .end local v2           #pinnedHeader:Landroid/view/View;
    .end local v3           #pinnedHeaderListView:Lcom/noshufou/android/su/widget/PinnedHeaderListView;
    :cond_0
    iget-object v4, p0, Lcom/noshufou/android/su/LogFragment;->mAdapter:Lcom/noshufou/android/su/widget/LogAdapter;

    invoke-virtual {v1, v4}, Landroid/widget/ListView;->setOnScrollListener(Landroid/widget/AbsListView$OnScrollListener;)V

    .line 79
    return-void
.end method


# virtual methods
.method public clearLog()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 113
    invoke-virtual {p0}, Lcom/noshufou/android/su/LogFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v0

    invoke-virtual {v0}, Landroid/support/v4/app/FragmentActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    sget-object v1, Lcom/noshufou/android/su/provider/PermissionsProvider$Logs;->CONTENT_URI:Landroid/net/Uri;

    invoke-virtual {v0, v1, v2, v2}, Landroid/content/ContentResolver;->delete(Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)I

    .line 114
    return-void
.end method

.method public clearLog(Landroid/view/View;)V
    .locals 0
    .parameter "view"

    .prologue
    .line 108
    invoke-virtual {p0}, Lcom/noshufou/android/su/LogFragment;->clearLog()V

    .line 109
    return-void
.end method

.method public onActivityCreated(Landroid/os/Bundle;)V
    .locals 4
    .parameter "savedInstanceState"

    .prologue
    .line 48
    invoke-super {p0, p1}, Landroid/support/v4/app/ListFragment;->onActivityCreated(Landroid/os/Bundle;)V

    .line 50
    invoke-virtual {p0}, Lcom/noshufou/android/su/LogFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    invoke-virtual {v1}, Landroid/support/v4/app/FragmentActivity;->getSupportFragmentManager()Landroid/support/v4/app/FragmentManager;

    move-result-object v1

    .line 51
    const v2, 0x7f0a0008

    invoke-virtual {v1, v2}, Landroid/support/v4/app/FragmentManager;->findFragmentById(I)Landroid/support/v4/app/Fragment;

    move-result-object v0

    .line 50
    check-cast v0, Landroid/support/v4/app/ListFragment;

    .line 52
    .local v0, appList:Landroid/support/v4/app/ListFragment;
    if-eqz v0, :cond_0

    .line 53
    invoke-virtual {v0}, Landroid/support/v4/app/ListFragment;->getListView()Landroid/widget/ListView;

    move-result-object v1

    invoke-virtual {v1}, Landroid/widget/ListView;->clearChoices()V

    .line 54
    invoke-virtual {v0}, Landroid/support/v4/app/ListFragment;->getListView()Landroid/widget/ListView;

    move-result-object v1

    invoke-virtual {v1}, Landroid/widget/ListView;->invalidateViews()V

    .line 57
    :cond_0
    invoke-direct {p0}, Lcom/noshufou/android/su/LogFragment;->setupListView()V

    .line 58
    invoke-virtual {p0}, Lcom/noshufou/android/su/LogFragment;->getLoaderManager()Landroid/support/v4/app/LoaderManager;

    move-result-object v1

    const/4 v2, 0x0

    const/4 v3, 0x0

    invoke-virtual {v1, v2, v3, p0}, Landroid/support/v4/app/LoaderManager;->initLoader(ILandroid/os/Bundle;Landroid/support/v4/app/LoaderManager$LoaderCallbacks;)Landroid/support/v4/content/Loader;

    .line 59
    return-void
.end method

.method public onClick(Landroid/view/View;)V
    .locals 1
    .parameter "view"

    .prologue
    .line 83
    invoke-virtual {p1}, Landroid/view/View;->getId()I

    move-result v0

    packed-switch v0, :pswitch_data_0

    .line 88
    :goto_0
    return-void

    .line 85
    :pswitch_0
    invoke-virtual {p0}, Lcom/noshufou/android/su/LogFragment;->clearLog()V

    goto :goto_0

    .line 83
    :pswitch_data_0
    .packed-switch 0x7f0a002c
        :pswitch_0
    .end packed-switch
.end method

.method public onCreateLoader(ILandroid/os/Bundle;)Landroid/support/v4/content/Loader;
    .locals 7
    .parameter "id"
    .parameter "args"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(I",
            "Landroid/os/Bundle;",
            ")",
            "Landroid/support/v4/content/Loader",
            "<",
            "Landroid/database/Cursor;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v4, 0x0

    .line 92
    new-instance v0, Landroid/support/v4/content/CursorLoader;

    invoke-virtual {p0}, Lcom/noshufou/android/su/LogFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    sget-object v2, Lcom/noshufou/android/su/provider/PermissionsProvider$Logs;->CONTENT_URI:Landroid/net/Uri;

    sget-object v3, Lcom/noshufou/android/su/widget/LogAdapter;->PROJECTION:[Ljava/lang/String;

    move-object v5, v4

    move-object v6, v4

    invoke-direct/range {v0 .. v6}, Landroid/support/v4/content/CursorLoader;-><init>(Landroid/content/Context;Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V

    return-object v0
.end method

.method public onCreateView(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Landroid/os/Bundle;)Landroid/view/View;
    .locals 4
    .parameter "inflater"
    .parameter "container"
    .parameter "savedInstanceState"

    .prologue
    .line 35
    const v2, 0x7f03000c

    const/4 v3, 0x0

    invoke-virtual {p1, v2, p2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v1

    .line 37
    .local v1, view:Landroid/view/View;
    const v2, 0x7f0a0033

    invoke-virtual {v1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/TextView;

    iput-object v2, p0, Lcom/noshufou/android/su/LogFragment;->mLogCountTextView:Landroid/widget/TextView;

    .line 38
    const v2, 0x7f0a002c

    invoke-virtual {v1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    .line 39
    .local v0, clearLogButton:Landroid/view/View;
    if-eqz v0, :cond_0

    .line 40
    invoke-virtual {v0, p0}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 43
    :cond_0
    return-object v1
.end method

.method public onLoadFinished(Landroid/support/v4/content/Loader;Landroid/database/Cursor;)V
    .locals 5
    .parameter
    .parameter "cursor"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/support/v4/content/Loader",
            "<",
            "Landroid/database/Cursor;",
            ">;",
            "Landroid/database/Cursor;",
            ")V"
        }
    .end annotation

    .prologue
    .local p1, loader:Landroid/support/v4/content/Loader;,"Landroid/support/v4/content/Loader<Landroid/database/Cursor;>;"
    const/4 v1, 0x0

    .line 97
    iget-object v0, p0, Lcom/noshufou/android/su/LogFragment;->mAdapter:Lcom/noshufou/android/su/widget/LogAdapter;

    invoke-virtual {v0, p2}, Lcom/noshufou/android/su/widget/LogAdapter;->swapCursor(Landroid/database/Cursor;)Landroid/database/Cursor;

    .line 98
    iget-object v2, p0, Lcom/noshufou/android/su/LogFragment;->mLogCountTextView:Landroid/widget/TextView;

    const v3, 0x7f0b0027

    const/4 v0, 0x1

    new-array v4, v0, [Ljava/lang/Object;

    if-eqz p2, :cond_0

    invoke-interface {p2}, Landroid/database/Cursor;->getCount()I

    move-result v0

    :goto_0
    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    aput-object v0, v4, v1

    invoke-virtual {p0, v3, v4}, Lcom/noshufou/android/su/LogFragment;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v2, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 99
    iget-object v0, p0, Lcom/noshufou/android/su/LogFragment;->mLogCountTextView:Landroid/widget/TextView;

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setVisibility(I)V

    .line 100
    return-void

    :cond_0
    move v0, v1

    .line 98
    goto :goto_0
.end method

.method public bridge synthetic onLoadFinished(Landroid/support/v4/content/Loader;Ljava/lang/Object;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 1
    check-cast p1, Landroid/support/v4/content/Loader;

    check-cast p2, Landroid/database/Cursor;

    invoke-virtual {p0, p1, p2}, Lcom/noshufou/android/su/LogFragment;->onLoadFinished(Landroid/support/v4/content/Loader;Landroid/database/Cursor;)V

    return-void
.end method

.method public onLoaderReset(Landroid/support/v4/content/Loader;)V
    .locals 2
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/support/v4/content/Loader",
            "<",
            "Landroid/database/Cursor;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 104
    .local p1, loader:Landroid/support/v4/content/Loader;,"Landroid/support/v4/content/Loader<Landroid/database/Cursor;>;"
    iget-object v0, p0, Lcom/noshufou/android/su/LogFragment;->mAdapter:Lcom/noshufou/android/su/widget/LogAdapter;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/noshufou/android/su/widget/LogAdapter;->swapCursor(Landroid/database/Cursor;)Landroid/database/Cursor;

    .line 105
    return-void
.end method
